﻿using Microsoft.EntityFrameworkCore.Migrations;

namespace ApiProject.Api.Migrations
{
    public partial class 添加分类Children : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "CommodityClassificationsId",
                table: "CommodityClassifications",
                type: "int",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_CommodityClassifications_CommodityClassificationsId",
                table: "CommodityClassifications",
                column: "CommodityClassificationsId");

            migrationBuilder.AddForeignKey(
                name: "FK_CommodityClassifications_CommodityClassifications_CommodityClassificationsId",
                table: "CommodityClassifications",
                column: "CommodityClassificationsId",
                principalTable: "CommodityClassifications",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_CommodityClassifications_CommodityClassifications_CommodityClassificationsId",
                table: "CommodityClassifications");

            migrationBuilder.DropIndex(
                name: "IX_CommodityClassifications_CommodityClassificationsId",
                table: "CommodityClassifications");

            migrationBuilder.DropColumn(
                name: "CommodityClassificationsId",
                table: "CommodityClassifications");
        }
    }
}
